package com.example.demo11.dem4;

/**
 * @program: demo11
 * @description:
 * @author: 诸葛龙辰
 * @create: 2022-10-31 20:39
 **/
public class People implements Runnable{
    private BankCard bankCard;
    public People(BankCard bankCard){
        this.bankCard=bankCard;
    }
    @Override
    public void run(){
        for (int i=0;i<10;i++){
            bankCard.setBalance(bankCard.getBalance()+1000);
            System.out.println(Thread.currentThread().getName()+"向卡中存入1000,卡中余额:"+bankCard.getBalance());
        }
    }
}
